<?php
include_once('connection/connection.php');
include('report/reportFunctions.php');
include('header.php');
include('menu.php');
include('config.php');
error_reporting(0);
$distId=$_SESSION['district'];
/*$qr_fact="SELECT population_factor from tbl_lookup_pop_factor where district_id='$distId'";
$res_fact = mysql_query($qr_fact);
$row_fact = mysql_fetch_array($res_fact);
$pop_factor=$row_fact['population_factor'];*/

$qr2="select * from tbl_dtls_ufw_main where multi_dist_id='$distId'";
//$qr2="select * from tbl_dtls_ufw_main AS m, tbl_lookup_location AS l where m.multi_dist_id='$distId'";
$res2 = mysql_query($qr2);
$row_cnt= mysql_num_rows($res2);
?>
<html>
<head>
<script language="javascript" type="text/javascript" >
function PrintContent()
{
var DocumentContainer = document.getElementById('ufw_div');
var WindowObject = window.open("PrintWindow",width=750,height=650,top=50,left=50,toolbars='no',scrollbars='yes',status='no',resizable='yes');
WindowObject.document.writeln(DocumentContainer.innerHTML);
WindowObject.document.close();
WindowObject.focus();
WindowObject.print();
WindowObject.close();
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<!--<meta http-equiv="Content-Type" content="application/vnd.ms-excel; charset=iso-8859-1"/>-->
<title>RWSS Report</title>
</head>
<body>
<div id="ufw_div">
<div align="center">
<form action="" method="post" enctype="multipart/form-data">
<!--Response.ContentType = "application/vnd.ms-excel"-->
<table border="0" width="800" cellspacing="0" cellpadding="0">
	<tr bgcolor="#E9E9E9">
		<td height="26">
		<p align="center"><span style="font-size: 9pt; font-weight: 700">
		<font face="Verdana" color="#224568">UFW Form Report</font></span></p></td>
	</tr>
	<tr>
		<td>&nbsp;</td>
	</tr>
	<tr bgcolor="#C5D8EB">
		<td height="56">
			<table border="1" width="800" cellspacing="0" cellpadding="0">
         		<tr>
					<td width="31" align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000">S.No.</font></td>
					<td width="46" align="center"><font face="Verdana" style="font-size: 8.5pt" color="#000000">Name of Scheme</font></td>
					<td width="37" align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000">Name of Blocks</font></td>
					<td width="76" align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000">Name of Panchayats</font></td>
					<td width="49" align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000">Name of Villages</font></td>
					<td width="55" align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000">Form Id</font></td>
					<td width="111" align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000">Date</font></td>
          		</tr>
          <?php
			$slNo = 1;							
			while($row2 = mysql_fetch_array($res2)) 
			{
			?>
          		<tr bgcolor="#F9F9F9" valign="top">
            		<td width="31" align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo $slNo; ?></font></td>
					<td width="46" align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo $nm_scheme=$row2['name_rwss']; ?></font></td>
            		<td width="37" align="center">
						<table border="1" width="" cellspacing="0" cellpadding="0" height="22" bordercolor="#C5D8EB" bgcolor="#F9F9F9">
                		<?php
							$blk_id=explode(',',$row2['multi_block_id']);
							$cnt_blk=count($blk_id);
							for($j=0; $j<$cnt_blk; $j++)
							{
						?>
                			<tr>
                  				<td width="" height="20" align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php $id=$blk_id[$j]; echo getName('block',$id);?></font></td>
                			</tr>
                	<?php } ?>
					</table>
				</td>
				<td width="37" align="center">
					<table border="1" width="" cellspacing="0" cellpadding="0" height="22" bordercolor="#C5D8EB" bgcolor="#F9F9F9">
                		<?php
							$panch_id=explode(',',$row2['multi_panchayat_id']);
							$cnt_panch=count($panch_id);
							for($j=0; $j<$cnt_panch; $j++)
							{
						?>
                		<tr>
                  			<td width="" height="20" align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000">
                    <?php $id=$panch_id[$j]; echo getName('panchayat',$id);?></font></td>
                		</tr>
                	<?php } ?>
            	</table>
			</td>
			<td width="37" align="center">
				<table border="1" width="" cellspacing="0" cellpadding="0" height="22" bordercolor="#C5D8EB" bgcolor="#F9F9F9">
                <?php
							$vil_id=explode(',',$row2['multi_village_id']);
							$cnt_vil=count($vil_id);
							for($j=0; $j<$cnt_vil; $j++)
							{
						?>
                	<tr>
                  		<td width="" height="20" align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000">
                    <?php $id=$vil_id[$j]; echo getName('village',$id);?></font></td>
                	</tr>
                <?php } ?>
            	</table>
			</td>
            <td width="49" align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo $row2['form_id'];?></font></td>
            <td width="49" align="center"><font style="font-size: 8.5pt" face="Verdana" color="#000000"><?php echo $row2['date']; ?></font></td>
        </tr>
          <?php 
			$slNo++;
			} ?>
        </table>
		</td>		
		</tr>
		<tr>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td align="center"><a href='' onClick='return PrintContent()'>Print this Report</a></td>
		</tr>
		<tr>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
		</tr>
</table>
</form>		
</div>
</div>	
</body>
</html>
